// pages/circle/square/cpns/menus/menus.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    menus: {
      type: Array,
      value: [
        [
          {
            txt: "城市探索",
            icon: "/assets/img/circle/1.png"
          },{
            txt: "美食分享",
            icon: "/assets/img/circle/2.png"
          },{
            txt: "旅行攻略",
            icon: "/assets/img/circle/3.png"
          },{
            txt: "本地生活",
            icon: "/assets/img/circle/4.png"
          },{
            txt: "摄影圈",
            icon: "/assets/img/circle/5.png"
          },{
            txt: "活动圈",
            icon: "/assets/img/circle/6.png"
          },{
            txt: "交友圈",
            icon: "/assets/img/circle/7.png"
          },{
            txt: "问答圈",
            icon: "/assets/img/circle/8.png"
          }
        ],
        [
          {
            txt: "生活圈",
            icon: "/assets/img/circle/9.png"
          },{
            txt: "兴趣圈",
            icon: "/assets/img/circle/10.png"
          },{
            txt: "搞笑圈",
            icon: "/assets/img/circle/11.png"
          },{
            txt: "学习圈",
            icon: "/assets/img/circle/12.png"
          },{
            txt: "公告圈",
            icon: "/assets/img/circle/13.png"
          },{
            txt: "游戏圈",
            icon: "/assets/img/circle/14.png"
          },{
            txt: "闲聊圈",
            icon: "/assets/img/circle/15.png"
          },
        ]
      ]
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    onMenuTap: function(e) {
      const index = e.currentTarget.dataset.index
      const menu = this.properties.menus[Math.floor(index / 8)][index % 8]
      
      wx.showToast({
        title: '进入' + menu.txt + '圈子',
        icon: 'none'
      })
      
      // 可以在这里添加跳转到具体圈子的逻辑
      // wx.navigateTo({
      //   url: '/pages/circle/detail/index?type=' + menu.txt
      // })
    }
  }
})
